package commands;

import java.util.EnumSet;

public enum AvailableCommands {
	ADD("add"), EDIT("edit"), REMOVE("remove"), COMPLETE("complete"), INCOMPLETE(
			"incomplete"), HELP("help"), LIST("list"), UNDO("undo"), REDO("redo"), QUIT(
			"quit"), VIEW("view"), SEARCH("search");

	private String value_;

	AvailableCommands(String value) {
		this.value_ = value;
	}

	public String toString() {
		return value_;
	}

	public static AvailableCommands getByValue(String value) {
		AvailableCommands returnValue = null;
		for (final AvailableCommands element : EnumSet
				.allOf(AvailableCommands.class)) {
			if (element.toString().equals(value)) {
				returnValue = element;
			}
		}
		return returnValue;
	}
}
